const user = {
    name: "kevin",
    age: 11,
    sex: "男",
    address: {
        province: "四川",
        city: "成都"
    },
    abc: undefined
}


// let name, age, sex, address, abc;
// name = user.name;
// age = user.age;
// sex = user.sex;
// address = user.address;
// abc = user.abc;



// let name, age, sex, address, abc;
// ({ name, age, sex, address, abc = 123 } = user);  // 不加小括号会报错

// 先定义5个变量，然后从对象中读取同名属性，放到变量中
let {name, age, sex, address, abc = 123} = user;  // 对象里面没有属性abc，或者值为undefined，则会赋值为undefined，若赋值为undefined，且有默认值，则会取默认值


console.log(name, age, sex, address === user.address, abc); 